Removes AND returns the item at the FRONT of target (the one pushed longest ago). If target is already empty, nothing is removed and a plain default value is returned instead (0/0.0/false/an empty string/`nothing`, depending on T) - target never crashes. Check queue_empty(target) first if you need to tell "the front was really this value" apart from "target was empty".
queue_pop(target) -> element| Name | Type |
|---|---|
target | queue |
element
Removes AND returns the item at the FRONT of target - the one pushed longest ago. Everything behind it moves one place closer to the front.
If target is already empty, nothing is removed and a plain default value is returned instead (0/0.0/false/an empty string/nothing, depending on target's element type) - target never crashes. Check queue_empty(target) first if the game needs to tell "the front really was this value" apart from "target was empty."
/// @type {queue<int>}
/// @capacity 4
var turn_order = [1, 2, 3];
var next_up = queue_pop(turn_order); // 1 - turn_order is now [2, 3]



the GBA module's own deque front()+pop_front() - O(1) (unlike list_remove(target, 0) on a list<T>, which is O(n) - this is queue<T>'s entire reason to exist over list<T>), and the empty case is checked before either is called. The default-value fallback is the same small compiled-in lambda stack_pop uses.